package com.example.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class VideoMessage implements Serializable {

    @JsonProperty("user_name")
    private String userName;

    @JsonProperty("platform_name")
    private String platformName;  // (B站和抖音)

    @JsonProperty("video_title")
    private String videoTitle;

    public String getUserName() {
        return userName;
    }

    public String getPlatformName() {
        return platformName;
    }

    public String getVideoTitle() {
        return videoTitle;
    }

    public String getVideoTime() {
        return videoTime;
    }

    public int getVideoPopularity() {
        return videoPopularity;
    }

    @JsonProperty("video_time")
    private String videoTime;

    @JsonProperty("video_popularity")
    private int videoPopularity;  // (0-2级别) 爆火，不温不火，冷门

    @Override
    public String toString() {
        String popularityLabel = getPopularityLabel(videoPopularity);
        return "VideoMessage{" +
                "userName='" + userName + '\'' +
                ", platformName='" + platformName + '\'' +
                ", videoTitle='" + videoTitle + '\'' +
                ", videoTime='" + videoTime + '\'' +
                ", videoPopularity='" + popularityLabel + '\'' +
                '}';
    }

    // 根据热度级别返回标签
    private String getPopularityLabel(int popularity) {
        switch (popularity) {
            case 0:
                return "冷门";
            case 1:
                return "不温不火";
            case 2:
                return "爆火";
            default:
                return "未知";
        }
    }
}
